package com.example.liuke.guangguang.untils;

import android.content.Context;
import android.content.Intent;
import android.os.CountDownTimer;
import android.widget.Toast;

import com.example.liuke.guangguang.ui.EventbusActivity;

/**
 * Created by liuke on 2017/11/24.
 */

public class CountTimer extends CountDownTimer {
    private Context context;

    /**
     * 参数 millisInFuture       倒计时总时间（如60S，120s等）
     * 参数 countDownInterval    渐变时间（每次倒计1s）
     */
    public CountTimer(long millisInFuture, long countDownInterval,Context context) {
        super(millisInFuture, countDownInterval);
        this.context=context;
    }
    // 计时完毕时触发
    @Override
    public void onFinish() {
        Toast.makeText(context,"长时间不动，开始屏保，设置时间为20s",Toast.LENGTH_LONG).show();
        context.startActivity(new Intent(context, EventbusActivity.class));

    }

    // 计时过程显示
    @Override
    public void onTick(long millisUntilFinished) {
    }
}
